

#include "StdAfx.h"
#include "ResizeDlg.h"

CWndProperties::CWndProperties()
{
	wndID = 0;
	hwndID = NULL;
	crDefPosition = CRect(0, 0, 0, 0);
	bXExpandable = false;
	bYExpandable = false;
	wndMasterXID = ALIGNMENT_MasterID_DefWin;
	wndMasterYID = ALIGNMENT_MasterID_DefWin;
	nMasterXAxis = ALIGNMENT_AXIS_VertLeft;
	nMasterYAxis = ALIGNMENT_AXIS_HorUp;
	nXAxis = ALIGNMENT_AXIS_VertLeft;
	nYAxis = ALIGNMENT_AXIS_HorUp;
	nXOffset = ALIGNMENT_AutoDetectOffset;
	nYOffset = ALIGNMENT_AutoDetectOffset;
	bIndirectGrowRatioAutomatic = true;
	nXGrowthRatio = 0;
	nYGrowthRatio = 0;
	nXIndirectGrowthRatio = 0;
	nYIndirectGrowthRatio = 0;
}

CWndProperties::CWndProperties(UINT nID)
{
	wndID = nID;
	hwndID = NULL;
	crDefPosition = CRect(0, 0, 0, 0);
	bXExpandable = false;
	bYExpandable = false;
	wndMasterXID = ALIGNMENT_MasterID_DefWin;
	wndMasterYID = ALIGNMENT_MasterID_DefWin;
	nMasterXAxis = ALIGNMENT_AXIS_VertLeft;
	nMasterYAxis = ALIGNMENT_AXIS_HorUp;
	nXAxis = ALIGNMENT_AXIS_VertLeft;
	nYAxis = ALIGNMENT_AXIS_HorUp;
	nXOffset = ALIGNMENT_AutoDetectOffset;
	nYOffset = ALIGNMENT_AutoDetectOffset;
	bIndirectGrowRatioAutomatic = true;
	nXGrowthRatio = 0;
	nYGrowthRatio = 0;
	nXIndirectGrowthRatio = 0;
	nYIndirectGrowthRatio = 0;
}

CWndProperties::CWndProperties(CWndProperties &rX)
{
	wndID = rX.wndID;
	hwndID = rX.hwndID;
	crDefPosition = rX.crDefPosition;
	crPosition = rX.crPosition;
	bXExpandable = rX.bXExpandable;
	bYExpandable = rX.bYExpandable;
	wndMasterXID = rX.wndMasterXID;
	wndMasterYID = rX.wndMasterYID;
	nMasterXAxis = rX.nMasterXAxis;
	nMasterYAxis = rX.nMasterYAxis;
	nXAxis = rX.nXAxis;
	nYAxis = rX.nYAxis;
	nXOffset = rX.nXOffset;
	nYOffset = rX.nYOffset;
	bIndirectGrowRatioAutomatic = rX.bIndirectGrowRatioAutomatic;
	nXGrowthRatio = rX.nXGrowthRatio;
	nYGrowthRatio = rX.nYGrowthRatio;
	nXIndirectGrowthRatio = rX.nXIndirectGrowthRatio;
	nYIndirectGrowthRatio = rX.nYIndirectGrowthRatio;
	csText = rX.csText;
	canDirectXDependencies.Copy(rX.canDirectXDependencies);
	canDirectYDependencies.Copy(rX.canDirectYDependencies);
	capDirectXDependencies.Copy(rX.capDirectXDependencies);
	capDirectYDependencies.Copy(rX.capDirectYDependencies);
	capAllXDependencies.Copy(rX.capAllXDependencies);
	capAllYDependencies.Copy(rX.capAllYDependencies);
	capTemp.Copy(rX.capTemp);
}

CWndProperties::~ CWndProperties()
{
}

void CWndProperties::operator=(const CWndProperties &rX)
{
	wndID = rX.wndID;
	hwndID = rX.hwndID;
	crDefPosition = rX.crDefPosition;
	crPosition = rX.crPosition;
	bXExpandable = rX.bXExpandable;
	bYExpandable = rX.bYExpandable;
	wndMasterXID = rX.wndMasterXID;
	wndMasterYID = rX.wndMasterYID;
	nMasterXAxis = rX.nMasterXAxis;
	nMasterYAxis = rX.nMasterYAxis;
	nXAxis = rX.nXAxis;
	nYAxis = rX.nYAxis;
	nXOffset = rX.nXOffset;
	nYOffset = rX.nYOffset;
	bIndirectGrowRatioAutomatic = rX.bIndirectGrowRatioAutomatic;
	nXGrowthRatio = rX.nXGrowthRatio;
	nYGrowthRatio = rX.nYGrowthRatio;
	nXIndirectGrowthRatio = rX.nXIndirectGrowthRatio;
	nYIndirectGrowthRatio = rX.nYIndirectGrowthRatio;
	csText = rX.csText;
	canDirectXDependencies.Copy(rX.canDirectXDependencies);
	canDirectYDependencies.Copy(rX.canDirectYDependencies);
	capDirectXDependencies.Copy(rX.capDirectXDependencies);
	capDirectYDependencies.Copy(rX.capDirectYDependencies);
	capAllXDependencies.Copy(rX.capAllXDependencies);
	capAllYDependencies.Copy(rX.capAllYDependencies);
	capTemp.Copy(rX.capTemp);
}


//search for pX in all x dependencies
//
bool CWndProperties::indirectXDependsBy(CWndProperties * pX)
{
	INT_PTR i, n;
	CWndProperties * pProp;
	n = capAllXDependencies.GetCount();
	for(i=0; i<n; i++)
	{
		pProp = capAllXDependencies[i];
		if (pProp == pX)
		{
			return true;
		}
	}

	return false;
}


//search for pX in all y dependencies
//
bool CWndProperties::indirectYDependsBy(CWndProperties * pY)
{
	INT_PTR i, n;
	CWndProperties * pProp;
	n = capAllYDependencies.GetCount();
	for(i=0; i<n; i++)
	{
		pProp = capAllYDependencies[i];
		if (pProp == pY)
		{
			return true;
		}
	}

	return false;
}